//
//  SRClassInfoHeaderView.m
//  StoryShow
//
//  Created by CyonLeuMBP on 2017/10/13.
//  Copyright © 2017年 qudiandu.cn. All rights reserved.
//

#import "SRClassInfoHeaderView.h"
#import <FZDirectionButton.h>

@interface SRClassInfoHeaderView ()

@property (weak, nonatomic) IBOutlet UIView *infoView;

@property (weak, nonatomic) IBOutlet UILabel *schoolNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *classNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *codeLabel;
@property (weak, nonatomic) IBOutlet FZDirectionButton *showMemberButton;


@end

@implementation SRClassInfoHeaderView

- (void)awakeFromNib {
	[super awakeFromNib];
	
	FZStyleSheet *css = [FZStyleSheet currentStyleSheet];
	self.schoolNameLabel.textColor = self.classNameLabel.textColor = self.codeLabel.textColor = [UIColor colorWithHex:0x4e4033];
	self.schoolNameLabel.font = self.classNameLabel.font = self.codeLabel.font = css.fontOfH5;
	
	self.showMemberButton.layoutDirection = FZDirectionButtonLayoutHorizontalImageLeft;
	[self.showMemberButton setTitleColor:[UIColor colorWithHex:0x4e4033] forState:UIControlStateNormal];
	self.backgroundColor = self.infoView.backgroundColor = css.color_5;

	
}

- (IBAction)onShowMemberAction:(id)sender{
	if (self.showMemberBlock) {
		self.showMemberBlock();
	}
}
- (IBAction)onCopyButton:(id)sender {
	
	UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
	pasteboard.string = self.model.inviteCode;
	if (self.showMessageBlock) {
		self.showMessageBlock(@"已复制");
	}
}

- (void)updateHeaderInfo:(SRSchoolClassListModel *)model {
	self.model = model;
	self.schoolNameLabel.text = [NSString stringWithFormat:@"学校名称：%@", self.model.schoolName];
	self.classNameLabel.text = [NSString stringWithFormat:@"班级名称：%@", self.model.name];
	self.codeLabel.text = [NSString stringWithFormat:@"班级邀请码：%@", self.model.inviteCode];
	
//	self.countLabel.text = [NSString stringWithFormat:@"班级学员（%ld）", (long)self.model.currentNum];

}

@end
